-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(no-unlocalized-strings): ignore more cases #84
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #84 +/- ##
=======================================
Coverage 96.49% 96.49%
=======================================
Files 10 10
Lines 371 371
Branches 101 101
=======================================
Hits 358 358
Misses 13 13 ☔ View full report in Codecov by Sentry. |
These additions look good. I upgraded from 0.7 to 0.8 and used the recommended ignores in the docs plus the ignores I was already using with 0.7. In 0.7, I had no errors, but with the new configuration, several things that used to be ignored were now being flagged (in my app's case, incorrectly). Since I just did this conversion, I made a list of the types of things I had to add additional ignores for. Here it is for reference. Not an error in 0.7 but is an error in 0.8 with the recommended configuration Strings that consist of variables and functions and spaces (
Properties of variables like {selectOption.text}` here:
Numbers that include percentages like The whitespace in this:
Variables with punctuation (perhaps this should be flagged, even though it wasn't before):
|
@ptmkenny thanks for your input. I also updated the plugin in my project and found some new strings flagged. Actually it is not always clear and straightforward what should be flagged and what's not. return <>{countDisplayLimit}+</>; For example this one should fall into "non word string" category, and should not be flagged. This is done to avoid thousands of strings for css and similar, such as Next: errorMessage += ` ${firstError.message.toString()} ${JSON.stringify(firstError.params)}`; This one for example also could be intuitive to be flagged for one and counterintuitive for others. Because there is something between variables to translates. Even order of variables placeholders might be a subject for translation. But i agree that in most of cases you rather want this one to be not flagged. I will go throw your cases and will update this PR if I found this required. |
- ignore when there is no text, and only variables - apply `ignore` option to the JSX Text - improve default Regexp in the documentation
e39df4e
to
d9ca52b
Compare
@ptmkenny I tested every case you submitted, they all covered with changes from this PR. I added explicit test cases to the suite for them. Note: return <>{countDisplayLimit}+</>; Still will not be flagged, as I mentioned above. |
Thank you, that's great! |
ignore
option to the JSX Text